package com.study;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import org.apache.commons.lang3.StringUtils;

import java.util.*;

/**
 * TODO
 *
 * @author wanghuilong
 * @version 1.0
 * @date 2021/11/25 8:39 下午
 */
public class Test5 {


    public static void main(String[] args) {
        String str = "com.jkys.share.product.client.service.business.NewCategoryService#queryAllBackedByCategoryList\t[\"批量查询后端类目\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#checkExistsFrontName\t[\"检查前端类目名称是否存在\"]\n" +
                "com.jkys.share.product.client.service.business.ItemSearchService#batchQuerySimpleItemInfoForBacked\t[\"批量查询商品简要信息-运营后台使用\"]\n" +
                "com.jkys.share.product.client.service.business.CoefficientManageService#query\t[\"查询推广系数\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#listSimpleStoreGoods\t[\"查询商家商品简要信息\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#saveGoodsTags\t[\"批量打标\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#getTagGroupDetail\t[\"查询标签值列表数据\",\"根据标签组搜索标签简要信息列表\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#checkBatchIdFrontCategory\t[\"校验一级类目和二级类目关系\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#checkBatchNameFrontCategory\t[\"批量检查名字一二级类目关系是否存在\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#getAllBackedCategory\t[\"查询所有后端类目\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#checkExistsBackedIds\t[\"检查后端类目id是否存在\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#saveMatchResult\t[\"批量保存匹配结果\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#deleteTag\t[\"通过标签值ID删除标签值\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#searchTag\t[\"根据名称搜索标签\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#storeGoodsPage\t[\"分页查询商家商品信息\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#addTagGroup\t[\"添加标签组\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#applyForecastCategory\t[\"更新预测类目\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#updateShopGoodsStatusV2\t[\"直接修改商品的上下架状态\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#getAllByParentCode\t[\"根据父类目code查询类目\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#batchAddBackCategory\t[\"批量增加后端类目\"]\n" +
                "com.jkys.share.product.client.service.business.CoefficientManageService#batchAdd\t[\"批量编辑渠道系数\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#getTagTreeInfo\t[\"获取标签组结果树\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#getStoreOriginProductInfo\t[\"获取商家商品源信息\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#addTag\t[\"添加标签值\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#batchAddFrontCategory\t[\"批量增加前端类目\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#getShopCategoryForApp\t[\"获取店铺类目数\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#updateAppCategorySort\t[\"商城类目更新顺序\",\"更新前端类目\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#queryAllDoctorCategory\t[\"获得所有医生端类目\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#updateDoctorCategory\t[\"医生端类目更新\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#listProductKeyInfo\t[\"批量查询商品的关键信息\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#getAllFrontInfoCategoryByList\t[\"查询所有前端类目信息\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#saveProductNames\t[\"批量修改药品商品名\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#batchUpdateTagName\t[\"修改标签值\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#exportTagInfo\t[\"导出标签组数据\"]\n" +
                "com.jkys.share.product.client.service.ProductTemplateBasicService#queryDrugsByName\t[\"根据通用名列表查询\"]\n" +
                "com.jkys.share.product.client.service.ProductBasicService#drugStoreProductDetail\t[\"根据skuCode查询商品详情\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#batchUpdateFrontCategory\t[\"批量更新前台类目\"]\n" +
                "com.jkys.share.product.client.service.ProductBasicService#queryFourKeySimilarSku\t[\"系统建议匹配列表\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#deleteTagGroup\t[\"通过标签组id删除标签组\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#saveDoctorCategory\t[\"增加医生端类目\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#getShopGoodsDetail\t[\"查询商品详情\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#setSaleChannels\t[\"修改推广系数\"]\n" +
                "com.jkys.share.product.client.service.business.DrugStoreShareService#matchMedicineInfoByProductIds\t[\"根据智云商品SKUID匹配\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#pageQueryTagGroup\t[\"查询标签组列表数据\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#batchAddTag\t[\"批量新增标签组数据\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#batchUpdateTag\t[\"批量更新标签组数据\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#getExistsItemCodes\t[\"判断itemCode是否存在\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#updateTagStatus\t[\"修改标签值状态\"]\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#batchAddTagForGnu\t[\"给中央药品库批量打标\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#getAllCategoryByFirstLevel\t[\"查询所有的一级类目\"]\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#queryAllSimpleDoctorCategory\t[\"查询所有医生端类目简要信息\",\"获取所有简单的医生端类目\"]\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#saveProductToCategory\t[\"更新商品类目\"]";
        String[] split = str.split("\n");
        System.out.println(split.length);
        Map<String, JSONArray> map = new LinkedHashMap<>();
        for (String s : split) {
            if (StringUtils.isBlank(s)) {
                continue;
            }
            String[] split1 = s.split("\t");
            String inter = split1[0];
            inter = inter.split("#")[0];
            JSONArray jsonArray = map.computeIfAbsent(inter, v -> new JSONArray());
            jsonArray.add(s);
        }
        System.out.println(map.size());

        for (Map.Entry<String, JSONArray> entry : map.entrySet()) {
            Iterator<Object> iterator = entry.getValue().stream().iterator();
            while (iterator.hasNext()) {
                System.out.println(iterator.next());
            }
        }

    }

}
